-
-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] Add authentication to Toolpad Core #3609
Conversation
b280db5
to
461b19d
Compare
Shaping a bit more the SIgnIn page. For now let's concentrate purely on this component
|
…pad into toolpad-core-auth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went mostly through the docs, everything seems good so nothing I wrote should be a major blocking change, I think. Let me know if there are any specific things besides docs that you'd like me to take a look at.
Also one more thing: the forgot password links in the demos are kind of weird as they link to the main MUI home page, can we do something about that?
|
||
## OAuth | ||
|
||
The `SignInPage` component can be set up with an OAuth provider by passing in a list of providers in the `providers` prop, along with a `signIn` function that accepts the `provider` as a parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be done in follow-up
We should also explain which oauth providers are supported
The component is composable with any authentication library you might want to use. The following is a functional `SignInPage` with [auth.js](https://authjs.dev/) using GitHub, Next.js App router and server actions. | ||
|
||
:::warning | ||
The following demo does not initiate an actual GitHub authentication flow, since doing that from within an `iframe` is not permitted. Run the [Next.js app directory](https://github.com/mui/mui-toolpad/tree/master/examples/core-auth-nextjs/) example to test this functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't the best form. Is this demo really necessary? Perhaps we can remove the demo and create an example instead (not as part of this PR)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added an image instead, remove the extended instructions and linked to the example that is created as part of this PR
|
||
When signed out, the component renders as an inline sign in button within the dashboard layout. If a `session` object is present, the component is rendered as a dropdown containing the user's account details as well as an option to sign out. | ||
|
||
{{"demo": "AccountDemo.js", "bg": "gradient" }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow up
The demo has some layout shift when signing in
@@ -2,7 +2,7 @@ import * as React from 'react'; | |||
import Card from '@mui/material/Card'; | |||
import CardContent from '@mui/material/CardContent'; | |||
import Typography from '@mui/material/Typography'; | |||
import Grid from '@mui/material/Unstable_Grid2'; | |||
import Grid from '@mui/material/Grid2'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 We may want to keep backwards compatibility with v5.
@mnajdova Will the /Unstable_Grid2
path be maintained during v6?
You're right; I've removed them for now - we can add them back once we have those components added? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's merge. We can iterate in follow-up
Closes #3419
ToolpadCoreAuth.mov
Sign In Page docs
Account docs
To Do List
SignInPage
componentUser
Account
componentslotProps
APIcore-auth-nextjs
workingcore-auth-nextjs-pages
workingFollow-up
<Account />
demo spacing/layout shift issuesRegisterPage
componentChangePasswordPage
componentslots
APISignInPage
Open topics
authentication
prop, should it contain the session?svgIcon
to be hidden by loading indicator material-ui#43003